package cn.chenfeifx.example.examples;

import cn.chenfeifx.core.common.FxUtil;
import cn.chenfeifx.core.controls.CFAvatar;
import cn.chenfeifx.core.controls.CFCarousel;
import javafx.collections.FXCollections;
import javafx.geometry.Pos;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;

public class DataExample extends StackPane {

    private final VBox vBox = new VBox();

    public DataExample() {
        getChildren().add(vBox);
        vBox.setMaxSize(USE_PREF_SIZE, USE_PREF_SIZE);
        vBox.setSpacing(50);
        vBox.setAlignment(Pos.CENTER);

        // 头像组件
        Image avatarImage = FxUtil.getImage("/img/avatar.png");
        //
        HBox avatarBox = new HBox(
                new CFAvatar(avatarImage),
                new CFAvatar(avatarImage, 100, 100),
                new CFAvatar(avatarImage, 80, 10)
        );
        avatarBox.setSpacing(50);
        avatarBox.setMaxSize(USE_PREF_SIZE, USE_PREF_SIZE);
        avatarBox.setAlignment(Pos.CENTER);

        // 轮播图
        CFCarousel cfCarousel = new CFCarousel(
                FXCollections.observableArrayList(
                        new ImageView(FxUtil.getImage("/img/img1.png")),
                        new ImageView(FxUtil.getImage("/img/img2.png")),
                        new ImageView(FxUtil.getImage("/img/img3.png")),
                        new ImageView(FxUtil.getImage("/img/img4.png")),
                        new ImageView(FxUtil.getImage("/img/img5.png"))
                ));

        //
        vBox.getChildren().addAll(avatarBox, cfCarousel);

    }

}
